﻿<%@ page contentType="text/html; charset=UTF-8" language="java"
	import="java.util.*,org.yoao.crm.acl.ACLTool,org.yoao.crm.page.framework.IViewPageService,org.yoao.crm.page.framework.ViewPageHelper,org.yoao.crm.bean.SignupBean"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";

	org.yoao.crm.bean.Session userSession = (org.yoao.crm.bean.Session) session
			.getAttribute("userSession");
	String actionPermission = userSession.getActionPermission();

	IViewPageService signupPage = (IViewPageService) session
			.getAttribute(ViewPageHelper.SESSION_PAGE);

	List list = (List) request.getAttribute("MINDLIST");

	String searchName = (String) request.getAttribute("searchName");
	if (searchName == null)
		searchName = "";
	String searchAddress = (String) request
			.getAttribute("searchAddress");
	if (searchAddress == null)
		searchAddress = "";
	String searchTime = (String) request.getAttribute("searchTime");
	if (searchTime == null)
		searchTime = "";
	String searchIsFlag = (String) request.getAttribute("searchIsFlag");
	if (searchIsFlag == null)
		searchIsFlag = "";
	String searchPhone = (String) request.getAttribute("searchPhone");
	if (searchPhone == null)
		searchPhone = "";
%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>思维导图报名列表</title>
		<jsp:include page="../public/publicJs.jsp" flush="false"></jsp:include>
		<script src="<%=basePath%>js/calendar.js">
</script>
		<script type="text/javascript">
var preTr = null;
var preColor = "";
function changeTrColor() {
	try {
		var tag = event.srcElement;
		while (tag.tagName != "TR")
			tag = tag.parentElement;
		switch (event.type) {
		case "mouseover":
			preColor = tag.currentStyle.backgroundColor;
			if (tag.currentStyle.highLightColor)
				tag.style.background = tag.currentStyle.highLightColor;
			else
				tag.style.background = "#FFFF00";
			break;
		case "mouseout":
			if (preTr != tag)
				tag.style.background = preColor;
			break;
		}
	} catch (E) {
	}
}

function openUser(id) {
	var user = window.showModalDialog(
			"<%=basePath%>kmjsp/dialog/datawindowUser.jsp", "用户选择",
			"dialogWidth=300px;dialogHeight=380px");
	if ("CANCELUSER" == user)
		return;
	if (user == "")
		user = "|";
	if (!user)
		return;

	var sarray = user.split("|");
	if (sarray != null) {

		//服务人员更改，更新客户表
		if (!id || id == "") {
			alert("未获取到报名人ID,数据未同步到客户中心!");
			return;
		}
		var vUrl = "<%=basePath%>customer.crm?method=allocation&tn=mindPic&id="
				+ id + "&sno=" + sarray[0];
		var result = ajax_getReturnText(vUrl);
		if (result.indexOf("[SUCCESS]") > -1) {
			var ida = id.split(",");
			for ( var i = 0; i < ida.length; i++) {
				document.getElementById("span_userName_" + ida[i]).innerText = sarray[1];
			}
		} else
			alert(result);
	}
}
</script>
	</head>
	<body topmargin="0" leftmargin="0"
		onLoad="setDivHeight('divList', -133);">
		<div id="div_load"
			style='display: block; background: #FFFFFF; width: 240px; height: 12px; margin-top: -120px; margin-left: -200px; left: 50%; top: 50%; position: absolute; padding: 5px 5px 5px 5px; z-index: 1'>
			<img src="<%=basePath%>images/loading.gif" class="icon1"
				align="absmiddle" />
			数据加载中,请稍后...
		</div>
		<table class="maintab_content_table" border="0" width="100%"
			cellspacing="0" cellpadding="0" height="25">
			<tr class="tree_title_txt">
				<td nowrap width="100%" class="tree_title_txt" valign="middle"
					id="cwCellTopTitTxt">
					<font color="#154288">思维导图报名列表 </font>
				</td>
			</tr>
		</table>

		<div id="ds"
			style="display: none; background: #EBEBEB; width: 100px; height: 20px; left: 50%; top: 50%; position: absolute; padding: 5px 5px 5px 5px; z-index: 1">
			<font color="#FF0000"><img
					src="<%=basePath%>images/loading.gif" alt="数据加载中" align="absmiddle" />数据加载中...</font>
		</div>
		<div style="width: 100%;">
			<fieldset
				style="width: 100%; TEXT-ALIGN: center; margin: 0px 5px 0px 5px;">
				<legend>
					&nbsp;搜索
					<img name="Changeicon" border="0"
						src="<%=basePath%>images/jt_b.gif"
						onClick="javascript:fieldsetHidden();" style="cursor: hand"
						title="显示/隐藏内容">
					&nbsp;
				</legend>
				<form name="searchForm" action="<%=basePath%>mind.crm?method=view"
					method="post">
					<center>
						<table border="0" width="100%" cellspacing="5" cellpadding="0">
							<tr>
								<td nowrap>
									姓名:
								</td>
								<td>
									<input name="searchName" accesskey="s" type="text"
										class="text_220" style="width: 130px" size="25"
										value="<%=searchName%>">
								</td>
								<td nowrap>
									地址:
								</td>
								<td>
									<input name="searchAddress" accesskey="s" type="text"
										class="text_220" style="width: 130px" size="25"
										value="<%=searchAddress%>">
								</td>
								<td nowrap>
									手机:
								</td>
								<td>
									<input name="searchPhone" accesskey="s" type="text"
										class="text_220" style="width: 130px" size="25"
										value="<%=searchPhone%>">
								</td>
							</tr>
							<tr>
								<td nowrap>
									是否成交:
								</td>
								<td>
									<select name="searchIsFlag" style="width: 130px">
										<option />
											<option value="1" <%if ("1".equals(searchIsFlag)) {%>
												selected <%}%> />
												已成交
												<option value="0" <%if ("0".equals(searchIsFlag)) {%>
													selected <%}%> />
													未成交
									</select>
								</td>
								<td nowrap>
									报名日期:
								</td>
								<td>
									<input name="searchTime" style="width: 130px" class="text_220"
										type="text" size="15" readonly maxlength="10"
										value="<%=searchTime%>" />
									<img onClick="calendar('', 'searchTime');return false"
										style="cursor: pointer;"
										src="<%=basePath%>images/tbtn_overtime.gif" width="20"
										height="19" border="0" align="absmiddle">
								</td>
								<td>
									<input name="image" type="image"
										src="<%=basePath%>images/tbtn_searh.gif" alt="查询"
										align="absmiddle" onclick="searchForm.submit();">
								</td>
							</tr>
						</table>
					</center>
				</form>
			</fieldset>
		</div>

		<form action="<%=basePath%>mind.crm?method=view" name="viewForm"
			method="post">
			<input name="searchName" type="hidden" value="<%=searchName%>">
			<input name="searchAddress" type="hidden" value="<%=searchAddress%>">
			<input name="searchIsFlag" type="hidden" value="<%=searchIsFlag%>">
			<input name="searchTime" type="hidden" value="<%=searchTime%>">
			<input name="searchPhone" type="hidden" value="<%=searchPhone%>">
			<table border="0" width="100%" height="25" cellspacing="0"
				cellpadding="0">
				<tr class="maintab">
					<td width="1%" align="center" valign="middle" id="cwCellTopTitTxt">
						&nbsp;
						<input type="checkbox" onClick="selectAction('itemselect')"
							value="1" />
					</td>
					<%
						if (ACLTool.isDelete(actionPermission)) {
					%>
					<td width="2%">
						<a href="#" accesskey="d"
							onClick="dataHander('delete','<%=basePath%>mind.crm?method=delete&id=', viewForm.itemselect);"><img
								align="absmiddle" src="<%=basePath%>images/sbtn_del.gif"
								alt="删除(Alt+D)" align="absmiddle"> </a>
					</td>
					<%
						}
						if (ACLTool.isExportOut(actionPermission)) {
					%>
					<td width="2%">
						<a href="#" accesskey="o"
							onClick="dataHander('exportout','<%=basePath%>kmjsp/app/export.jsp?key=out&tn=mindPic&id=', viewForm.itemselect);"><img
								align="absmiddle" src="<%=basePath%>images/sbtn_out.gif"
								alt="导出(Alt+O)" align="absmiddle"> </a>
					</td>
					<%
						}
						if (ACLTool.isAllocation(actionPermission)) {
					%>
					<td width="2%">
						<a href="#" accesskey="m"
							onClick="dataHander('allocation','<%=basePath%>kmjsp/dialog/datawindowUser.jsp', viewForm.itemselect);"><img
								align="absmiddle" src="<%=basePath%>images/btn_seluser.gif"
								alt="分配业务员(Alt+M)" align="absmiddle"> </a>
					</td>
					<%
						}
						if (ACLTool.isSuccess(actionPermission)) {
					%>
					<td width="2%">
						<a href="#" accesskey="q"
							onClick="dataHander('signature','<%=basePath%>mind.crm?method=signature&v=1&id=', viewForm.itemselect);"><img
								align="absmiddle" src="<%=basePath%>images/sbtn_selall.gif"
								alt="已成交(Alt+Q)" align="absmiddle"> </a>
					</td>
					<%
						}
					%>
					<td nowrap width="68%" align="right">
						<input id="<%=ViewPageHelper.PAGE_ACTION%>"
							name="<%=ViewPageHelper.PAGE_ACTION%>" type="hidden" value="" />
						共
						<%=signupPage.getTotalRows()%>条 /
						<%=signupPage.getPageCount()%>
						页
						<%
							if (signupPage.getPageIndex() > 1) {
						%>
						<img align="absmiddle" style="cursor: pointer;"
							onClick="goPage('FIRST_PAGE')"
							src="<%=basePath%>images/ico_first.gif" alt="首页" border="0" />
						<img align="absmiddle" style="cursor: pointer;"
							onClick="goPage('PREVIOUS_PAGE')"
							src="<%=basePath%>images/ico_prev.gif" alt="上一页" border="0" />
						<%
							} else {
						%>
						<img align="absmiddle" style="filter: Gray;"
							src="<%=basePath%>images/ico_first.gif" alt="首页" border="0" />
						<img align="absmiddle" style="filter: Gray;"
							src="<%=basePath%>images/ico_prev.gif" alt="上一页" border="0" />
						<%
							}
						%>
						第
						<font color="red"><%=signupPage.getPageIndex()%></font> 页
						<%
							if (signupPage.getPageIndex() < signupPage.getPageCount()) {
						%>
						<img align="absmiddle" style="cursor: pointer;"
							onClick="goPage('NEXT_PAGE')"
							src="<%=basePath%>images/ico_next.gif" alt="下一页" border="0" />
						<img align="absmiddle" style="cursor: pointer;"
							onClick="goPage('LAST_PAGE')"
							src="<%=basePath%>images/ico_last.gif" alt="尾页" border="0/">
						<%
							} else {
						%>
						<img align="absmiddle" style="filter: Gray;"
							src="<%=basePath%>images/ico_next.gif" alt="下一页" border="0" />
						<img align="absmiddle" style="filter: Gray;"
							src="<%=basePath%>images/ico_last.gif" alt="尾页" border="0" />
						<%
							}
						%>
					</td>
					<td nowrap width="1%">
						<img align="absmiddle" src="<%=basePath%>images/sbtn_split.gif" />
					</td>
					<td nowrap width="8%">
						转到&nbsp;
						<input id="<%=ViewPageHelper.PAGE_NO%>"
							name="<%=ViewPageHelper.PAGE_NO%>" type="text" size="2"
							value="<%=signupPage.getPageIndex()%>"
							onKeyPress="javascript:if(event.keyCode == 13){goPage('jump');}" />
						&nbsp;页
						<img align="absmiddle" style="cursor: pointer;"
							onClick="goPage('jump')" src="<%=basePath%>images/goto.gif"
							alt="执行" border="0" align="absmiddle">
					</td>
				</tr>
			</table>

			<div id="divList"
				style="vertical-align: top; width: 100%; overflow: auto;">
				<table border="0" style="border-collapse: collapse;" align="center"
					cellpadding="0" cellspacing="0" width="100%"
					class="maintab_content_table">
					<tr class="maintab_content_table_title">
						<th width="1%"></th>
						<th align="center" nowrap width="10%">
							姓名
						</th>
						<th align="center" nowrap width="25%">
							地址
						</th>
						<th align="center" nowrap width="19%">
							E-Mail
						</th>
						<th align="center" nowrap width="10%">
							手机
						</th>
						<th align="center" nowrap width="10%">
							报名时间
						</th>
						<th align="center" nowrap width="25%">
							报名理由
						</th>
						<th align="center" nowrap width="10%">
							是否成交
						</th>
						<th align="center" nowrap width="25%" colspan="2">
							备注
						</th>
						<th align="center" nowrap width="20%" colspan="2">
							服务人员
						</th>
					</tr>
					<%
						if (list != null) {
							int size = list.size();
							for (int i = 0; i < size; i++) {
								SignupBean bean = (SignupBean) list.get(i);
					%>
					<tr onMouseOver="changeTrColor()" onMouseOut="changeTrColor()"
						title="<%=bean.getName()%>">
						<td nowrap align="center">
							<input class="rd" type="checkbox" name="itemselect"
								value="<%=bean.getId()%>" />
						</td>
						<td nowrap><%=bean.getName()%></td>
						<td nowrap><%=bean.getAddress()%></td>
						<td nowrap><%=bean.getEmail()%></td>
						<td nowrap><%=bean.getSj()%></td>
						<td nowrap><%=bean.getTime()%></td>
						<td nowrap><%=bean.getIntro()%></td>
						<td nowrap align="center"><%=bean.getIsFlag() == 1 ? "已成交" : "未成交"%></td>
						<td nowrap><%=bean.getMemo() != null ? bean.getMemo()
							: "&nbsp;"%></td>
						<td nowrap width="2%">
							<%
								if (ACLTool.isModifyMemo(actionPermission)) {
							%>
							<img
								onClick="exportWindow('<%=basePath%>/kmjsp/app/memo.jsp?id=<%=bean.getId()%>&mode=MIND');"
								src="<%=basePath%>images/sbtn_mod.gif" alt="修改备注"
								align="absmiddle" style="cursor: pointer" />
							<%
								}
							%>
						</td>
						<td nowrap>
							<span id="span_userName_<%=bean.getId()%>"><%=bean.getUserName() != null ? bean.getUserName()
							: ""%></span>
						</td>
						<td nowrap width="2%"
							<%if (ACLTool.isAllocation(actionPermission)) {%>
							style="display: blank" <%} else {%> style="display:none" <%}%>>
							<img onclick="openUser('<%=bean.getId()%>');"
								src="<%=basePath%>images/btn_seluser.gif" alt="分配业务员"
								align="absmiddle" style="cursor: pointer" />
						</td>
					</tr>
					<%
						}
						}
					%>
				</table>
			</div>
		</form>
	</body>
</html>
<script>
document.getElementById("div_load").style.display = "none";</script>